home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1992 June: ROMin Holiday / ADC Developer CD (1992-06) (''ROMin Holiday'')_iso / Developer Connection - 06-1992.iso / Developer Essentials / MPW Interfaces & Libraries / AIncludes / SlotEqu.a < prev    next >
Encoding:
Text File  |  1992-01-29  |  13.3 KB  |  517 lines  |  [TEXT/MPS ]

  1. ; Version: 2.54
  2. ; Created: Thursday, August 3, 1989 at 6:28:07 PM
  3. ;
  4. ; File: SlotEqu.a
  5. ;
  6. ; Assembler Interface to the Macintosh Libraries
  7. ; Copyright Apple Computer, Inc. 1986-1991
  8. ; All Rights Reserved
  9. ;
  10. ;--------------------------------------------------------------------
  11.  
  12.     IF &TYPE('__IncludingSlotEqu__') = 'UNDEFINED' THEN
  13. __IncludingSlotEqu__    SET    1
  14.  
  15.     IF &TYPE('__IncludingTraps__') = 'UNDEFINED' THEN       ; get defintion of _SlotManager
  16.     INCLUDE 'Traps.a'
  17.     ENDIF
  18.  
  19. ; sInfo Array status flags (StatusFlags) in bit numbers
  20.  
  21. fDontUse          EQU         0                         ; old slotmgr put fcardIsChanged here
  22. fCardIsChanged    EQU         1                         ; card is Changed field in StatusFlags field of sInfoArray
  23. fTempEnabled      EQU         2                         ; slot is temporarily enabled
  24.  
  25. ; spBlock flags (spFlags)
  26.  
  27. fCkForNext        EQU         $00                       ; check for NEXT sRsrc in SRT            (SearchSRT)
  28. fCkReserved       EQU         $01                       ; check reserved field for zero         (ReadPBSize)
  29. fWarmStart        EQU         $02                       ; warm start, else cold start            (PrimaryInit)
  30. fClear            EQU         $03                       ; clear the memory                        (sNewPtr)
  31. fSys              EQU         $04                       ; alloc  on system heap                 (sNewPtr)
  32. fConsecBytes      EQU         $05                       ; calc step value for consecutive bytes (CalcStep)
  33.  
  34. ; flag bits for spParamData
  35.  
  36. fAll              EQU         0                         ; bit 0: set=search enabled/disabled sRsrc's
  37. fOneSlot          EQU         1                         ;      1: set=search sRsrc's in given slot only
  38. fNext             EQU         2                         ;      2: set=search for next sRsrc
  39.  
  40. ; sResource flags (sRsrc_Flags) - flags 8-15 are entered into srt flags field
  41.  
  42. fOpenAtStart      EQU         1                         ; open the driver at start time, else do not
  43. f32BitMode        EQU         2                         ; a 32-bit address will be put into dctlDevBase
  44.  
  45. ; state constants for sInfoRecord
  46.  
  47. stateNil          EQU         0                         ; uninitialized sInfoRecord
  48. stateSDMInit      EQU         1                         ; sInfoRecord initialized - executed InitSDeclMgr
  49. statePRAMInit     EQU         2                         ; sPRAM record initialized - executed InitSPRAMRec
  50. statePInit        EQU         3                         ; primary Init executed
  51. stateSInit        EQU         4                         ; secondary init executed
  52.  
  53. ;Misc masks <6>
  54.  
  55. catMask            EQU            $08                        ; sets spCategory field of spTBMask (bit 3)
  56. cTypeMask        EQU            $04                        ; sets spCType    field of spTBMask (bit 2)
  57. drvrSWMask        EQU            $02                        ; sets spDrvrSW   field of spTBMask (bit 1)
  58. drvrHWMask        EQU            $01                        ; sets spDrvrHW      field of spTBMask (bit 0)
  59.  
  60. ;Misc constants
  61.  
  62. sizeSPRAMRec      EQU         8                         ; size of sPRAM record
  63. smPRAMTop         EQU         $46                       ; address of beginning of slot PRAM area
  64. majorSpace        EQU         $90                       ; high byte of beginning of major space
  65.  
  66. TotalSlots        EQU         15                        ; number of slot supported
  67. minorLast         EQU         $FEFFFFFF                 ; last minor slot addr
  68. FirstPRAMSlot     EQU         $9                        ; First slot with PRAM allocated
  69. sNumSlots         EQU         6                         ; used for number of slot interrupts supported on via
  70. sFirstSlot        EQU         $9                        ; First slot supported
  71. sLastSlot         EQU         $E                        ; The last slot.
  72. minorStep         EQU         $01000000                 ; value to step minor address to next slot
  73. retryCnt          EQU         100                       ; default retry cnt on a Nubus read bus error
  74.  
  75. lastSDMSelt       EQU         $3D                       ;The last SDM selector
  76.  
  77. ;
  78. ;    Slot interrupt queue element  -  Used to install a slot interrupt handler by sInitInstall
  79. ;
  80.  
  81. SlotIntQElement   RECORD      0
  82. sqLink            DS.L        1                         ; Ptr - ptr to next element
  83. sqType            DS.W        1                         ; INTEGER - queue type ID for validity
  84. sqPrio            DS.W        1                         ; INTEGER - priority
  85. sqAddr            DS.L        1                         ; ProcPtr - interrupt service routine
  86. sqParm            DS.L        1                         ; LONGINT - optional A1 parameter
  87. sqHDSize          EQU         *                         ; size of slot queue header element
  88.                   ENDR
  89.  
  90. ;
  91. ;    Slot Parameter Block  -  parameter block to all slot manager routines.    All fields
  92. ;    may be inputs, or outputs.
  93. ;
  94.  
  95. SpBlock           RECORD      0
  96. spResult          DS.L        1                         ; result
  97. spSPointer        DS.L        1                         ; general pointer
  98. spSize            DS.L        1                         ; size
  99. spOffsetData      DS.L        1                         ; Offset/Data field value            (sOffsetData)
  100. spIOFileName      DS.L        1                         ; Pointer to IOFile name            (not used)
  101. spSExecPBlk       DS.L        1                         ; Pointer to sExec block
  102. spParamData       DS.L        1                         ; misc parameter data                (formerly spStackPtr)
  103. spMisc            DS.L        1                         ; Misc field for SDM                (not used)
  104. spReserved        DS.L        1                         ; Reserved for future expansion
  105. spIOReserved      DS.W        1                         ; Reserved field of SRT
  106. spRefNum          DS.W        1                         ; RefNum
  107. spCategory        DS.W        1                         ; sResource category
  108. spCType           DS.W        1                         ;            type
  109. spDrvrSW          DS.W        1                         ;            drvrsw
  110. spDrvrHW          DS.W        1                         ;            drvrhw
  111. spTBMask          DS.B        1                         ; type bit mask (bit 0 set = ignore drvrhw, bit 1 = drvrsw, ...)
  112. spSlot            DS.B        1                         ; slot number.
  113. spId              DS.B        1                         ; sResource id
  114. spExtDev          DS.B        1                         ; external device id
  115. spHwDev           DS.B        1                         ; hardware device id
  116. spByteLanes       DS.B        1                         ; bytelanes value from FHeader in the declaration ROM.
  117. spFlags           DS.B        1                         ; general flags
  118. spKey             DS.B        1                         ; reserved                            (not used)
  119. spBlockSize       EQU         *                         ; Size of spBlock
  120.                   ENDR
  121.  
  122. ;
  123. ;    sInfo Record  -  general slot information.    A record exists for each slot
  124.  
  125.  
  126. SInfoRecord       RECORD      0                         ;Slot information record. sInfo Array[1..NumSlots]
  127. siDirPtr          DS.L        1                         ; Pointer to directory
  128. siInitStatusA     DS.W        1                         ; Fundamental Error
  129. siInitStatusV     DS.W        1                         ; Status returned by vendor Init code
  130. siState           DS.B        1                         ; Initialization State (Primary, Secondary)
  131. siCPUByteLanes    DS.B        1                         ; CPU Byte Lanes. Each bit set signifies a byte-lane used.
  132. siTopOfROM        DS.B        1                         ; Top of ROM = $FssFFFFx, where x is TopOfROM.
  133. siStatusFlags     DS.B        1                         ; Bit-0:Card is changed
  134. siTOConst         DS.W        1                         ; Time Out Constant for BusErr
  135. siReserved        DS.B        2                         ; Reserved, must be 0
  136. sInfoRecSize      EQU         *                         ; Size of sInfoRecord
  137. siROMAddr         DS.L        1                         ; Address of top of ROM (major or minor space)
  138. siSlot            DS.B        1                         ; slot number
  139. siPadding         DS.B        3                         ; padding to bring out to next long
  140. sInfoNewSize      EQU         *                         ; size of new sInfo record
  141.                   ENDR
  142.  
  143. FHeaderRec        RECORD      0
  144. fhDirOffset       DS.L        1                         ;Offset to directory
  145. fhLength          DS.L        1                         ;Length of ROM
  146. fhCRC             DS.L        1                         ;CRC
  147. fhROMRev          DS.B        1                         ;Revision of ROM
  148. fhFormat          DS.B        1                         ;Format-2
  149. fhTstPat          DS.L        1                         ;TestPattern
  150. fhReserved        DS.B        1                         ;Reserved
  151. fhByteLanes       DS.B        1                         ;ByteLanes
  152. fhBlockSize       EQU         *
  153.                   ENDR
  154.  
  155. OffsetToDir       EQU         FHeaderRec.fhDirOffset-FHeaderRec.fhBlockSize+1
  156.                                                         ; offset to dir ptr
  157.  
  158. SEBlock           RECORD      0                         ;Parameter block for code executed by sExec.
  159. ;------- elements of all seBlocks ------
  160. seSlot            DS.B        1                         ; Slot number.
  161. seSRsrcId         DS.B        1                         ; sResource Id.
  162. seStatus          DS.W        1                         ; Status of code executed by sExec.
  163. seFlags           DS.B        1                         ; Flags.
  164. seFiller          DS.B        3                         ; Filler
  165. ;------- extensions for sLoad + sBoot ------
  166. seResult          DS.L        1                         ; Result of sLoad.
  167. seIOFileName      DS.L        1                         ; Pointer to IOFile name.
  168. seDevice          DS.B        1                         ; Which device to read from.
  169. sePartition       DS.B        1                         ; The partition.
  170. seOSType          DS.B        1                         ; Type of OS.
  171. seReserved        DS.B        1                         ; Reserved field.
  172. seRefNum          DS.B        1                         ; RefNum of the driver.
  173. ;------- extensions for sBoot ------
  174. seNumDevices      DS.B        1                         ; Number of devices to load.
  175. seBootState       DS.B        1                         ; State of StartBoot code.
  176.                   ALIGN       2
  177. seBlockSize       EQU         *                         ; Size of se parameter Block
  178.                   ENDR
  179.  
  180. ; Slot Manager Selectors:
  181. ;
  182. ; PRINCIPLE
  183.  
  184. sReadByte         EQU         $00
  185. sReadWord         EQU         $01
  186. sReadLong         EQU         $02
  187. sGetCString       EQU         $03
  188. sGetBlock         EQU         $05
  189. sFindStruct       EQU         $06
  190. sReadStruct       EQU         $07
  191. sVersion          EQU         $08
  192. sSetSRsrcState    EQU         $09
  193. sInsertSRTRec     EQU         $0A
  194. sGetSRsrc         EQU         $0B
  195. sGetTypeSRsrc     EQU         $0C
  196.  
  197. ; SPECIAL
  198. sReadInfo         EQU         $10
  199. sReadPRAMRec      EQU         $11
  200. sPutPRAMRec       EQU         $12
  201. sReadFHeader      EQU         $13
  202. sNextSRsrc        EQU         $14
  203. sNextTypeSRsrc    EQU         $15
  204. sRsrcInfo         EQU         $16
  205. sDisposePtr       EQU         $17
  206. sCkCardStat       EQU         $18
  207. sReadDrvrName     EQU         $19
  208. sFindSRTRec       EQU         $1A
  209. sFindDevBase      EQU         $1B
  210. sFindBigDevBase    EQU         $1C
  211. sGetSRsrcPtr      EQU         $1D
  212.  
  213. ; Advanced
  214. initSDeclMgr      EQU         $20
  215. sPrimaryInit      EQU         $21
  216. sCardChanged      EQU         $22
  217. sExec             EQU         $23
  218. sOffsetData       EQU         $24
  219. sInitPRAMRecs     EQU         $25
  220. sReadPBSize       EQU         $26
  221.  
  222. sCalcStep         EQU         $28
  223. sInitSRsrcTable    EQU         $29
  224. sSearchSRT        EQU         $2A
  225. sUpdateSRT        EQU         $2B
  226. sCalcSPointer     EQU         $2C
  227. sGetDriver        EQU         $2D
  228. sPtrToSlot        EQU         $2E
  229. sFindSInfoRecPtr EQU         $2F
  230. sFindSRsrcPtr     EQU         $30
  231. sDeleteSRTRec     EQU         $31
  232. sSecondaryInit    EQU         $32
  233. sInitSlotPRAM     EQU         $33
  234.  
  235.  
  236. ;#####################################################################
  237. ; PRINCIPLE
  238. ;#####################################################################
  239.  
  240.                   MACRO
  241.                   _SReadByte
  242.                   MOVEQ       #sReadByte,D0
  243.                   _SlotManager
  244.                   ENDM
  245.  
  246.                   MACRO
  247.                   _SReadWord
  248.                   MOVEQ       #sReadWord,D0
  249.                   _SlotManager
  250.                   ENDM
  251.  
  252.                   MACRO
  253.                   _SReadLong
  254.                   MOVEQ       #sReadLong,D0
  255.                   _SlotManager
  256.                   ENDM
  257.  
  258.                   MACRO
  259.                   _SGetCString
  260.                   MOVEQ       #sGetCString,D0
  261.                   _SlotManager
  262.                   ENDM
  263.  
  264.                   MACRO
  265.                   _SGetBlock
  266.                   MOVEQ       #sGetBlock,D0
  267.                   _SlotManager
  268.                   ENDM
  269.  
  270.                   MACRO
  271.                   _SFindStruct
  272.                   MOVEQ       #sFindStruct,D0
  273.                   _SlotManager
  274.                   ENDM
  275.  
  276.                   MACRO
  277.                   _SReadStruct
  278.                   MOVEQ       #sReadStruct,D0
  279.                   _SlotManager
  280.                   ENDM
  281.  
  282.                   MACRO
  283.                   _SVersion
  284.                   MOVEQ       #sVersion,D0
  285.                   _SlotManager
  286.                   ENDM
  287.  
  288.                   MACRO
  289.                   _SetSRsrcState
  290.                   MOVEQ       #sSetSRsrcState,D0
  291.                   _SlotManager
  292.                   ENDM
  293.  
  294.                   MACRO
  295.                   _InsertSRTRec
  296.                   MOVEQ       #sInsertSRTRec,D0
  297.                   _SlotManager
  298.                   ENDM
  299.  
  300.                   MACRO
  301.                   _GetSRsrc
  302.                   MOVEQ       #sGetSRsrc,D0
  303.                   _SlotManager
  304.                   ENDM
  305.  
  306.                   MACRO
  307.                   _GetTypeSRsrc
  308.                   MOVEQ       #sGetTypeSRsrc,D0
  309.                   _SlotManager
  310.                   ENDM
  311.  
  312.  
  313. ;#####################################################################
  314. ; SPECIAL
  315. ;#####################################################################
  316.                   MACRO
  317.                   _SReadInfo
  318.                   MOVEQ       #sReadInfo,D0
  319.                   _SlotManager
  320.                   ENDM
  321.  
  322.                   MACRO
  323.                   _SReadPRAMRec
  324.                   MOVEQ       #sReadPRAMRec,D0
  325.                   _SlotManager
  326.                   ENDM
  327.  
  328.                   MACRO
  329.                   _SPutPRAMRec
  330.                   MOVEQ       #sPutPRAMRec,D0
  331.                   _SlotManager
  332.                   ENDM
  333.  
  334.                   MACRO
  335.                   _SReadFHeader
  336.                   MOVEQ       #sReadFHeader,D0
  337.                   _SlotManager
  338.                   ENDM
  339.  
  340.                   MACRO
  341.                   _SNextSRsrc
  342.                   MOVEQ       #sNextSRsrc,D0
  343.                   _SlotManager
  344.                   ENDM
  345.  
  346.                   MACRO
  347.                   _SNextTypeSRsrc
  348.                   MOVEQ       #sNextTypeSRsrc,D0
  349.                   _SlotManager
  350.                   ENDM
  351.  
  352.                   MACRO
  353.                   _SRsrcInfo
  354.                   MOVEQ       #sRsrcInfo,D0
  355.                   _SlotManager
  356.                   ENDM
  357.  
  358.                   MACRO
  359.                   _SDisposePtr
  360.                   MOVEQ       #sDisposePtr,D0
  361.                   _SlotManager
  362.                   ENDM
  363.  
  364.                   MACRO
  365.                   _SCkCardStat
  366.                   MOVEQ       #sCkCardStat,D0
  367.                   _SlotManager
  368.                   ENDM
  369.  
  370.                   MACRO
  371.                   _SReadDrvrName
  372.                   MOVEQ       #sReadDrvrName,D0
  373.                   _SlotManager
  374.                   ENDM
  375.  
  376.                   MACRO
  377.                   _FindSRTRec
  378.                   MOVEQ       #sFindSRTRec,D0
  379.                   _SlotManager
  380.                   ENDM
  381.  
  382.                   MACRO
  383.                   _SFindDevBase
  384.                   MOVEQ       #sFindDevBase,D0
  385.                   _SlotManager
  386.                   ENDM
  387.  
  388.                   MACRO
  389.                   _SFindBigDevBase
  390.                   MOVEQ       #sFindBigDevBase,D0
  391.                   _SlotManager
  392.                   ENDM
  393.  
  394.                   MACRO
  395.                   _GetSRsrcPtr
  396.                   MOVEQ       #sGetSRsrcPtr,D0
  397.                   _SlotManager
  398.                   ENDM
  399.  
  400. ;#####################################################################
  401. ; Advanced
  402. ;#####################################################################
  403.                   MACRO
  404.                   _InitSDeclMgr
  405.                   MOVEQ       #initSDeclMgr,D0
  406.                   _SlotManager
  407.                   ENDM
  408.  
  409.                   MACRO
  410.                   _SPrimaryInit
  411.                   MOVEQ       #sPrimaryInit,D0
  412.                   _SlotManager
  413.                   ENDM
  414.  
  415.                   MACRO
  416.                   _SCardChanged
  417.                   MOVEQ       #sCardChanged,D0
  418.                   _SlotManager
  419.                   ENDM
  420.  
  421.                   MACRO
  422.                   _SExec
  423.                   MOVEQ       #sExec,D0
  424.                   _SlotManager
  425.                   ENDM
  426.  
  427.                   MACRO
  428.                   _SOffsetData
  429.                   MOVEQ       #sOffsetData,D0
  430.                   _SlotManager
  431.                   ENDM
  432.  
  433.                   MACRO
  434.                   _SInitPRAMRecs
  435.                   MOVEQ       #sInitPRAMRecs,D0
  436.                   _SlotManager
  437.                   ENDM
  438.  
  439.                   MACRO
  440.                   _SReadPBSize
  441.                   MOVEQ       #sReadPBSize,D0
  442.                   _SlotManager
  443.                   ENDM
  444.  
  445.                   MACRO
  446.                   _SCalcStep
  447.                   MOVEQ       #sCalcStep,D0
  448.                   _SlotManager
  449.                   ENDM
  450.  
  451.                   MACRO
  452.                   _SInitSRsrcTable
  453.                   MOVEQ       #sInitSRsrcTable,D0
  454.                   _SlotManager
  455.                   ENDM
  456.  
  457.                   MACRO
  458.                   _SSearchSRT
  459.                   MOVEQ       #sSearchSRT,D0
  460.                   _SlotManager
  461.                   ENDM
  462.  
  463.                   MACRO
  464.                   _SUpdateSRT
  465.                   MOVEQ       #sUpdateSRT,D0
  466.                   _SlotManager
  467.                   ENDM
  468.  
  469.                   MACRO
  470.                   _SCalcSPointer
  471.                   MOVEQ       #sCalcSPointer,D0
  472.                   _SlotManager
  473.                   ENDM
  474.  
  475.                   MACRO
  476.                   _SGetDriver
  477.                   MOVEQ       #sGetDriver,D0
  478.                   _SlotManager
  479.                   ENDM
  480.  
  481.                   MACRO
  482.                   _SPtrToSlot
  483.                   MOVEQ       #sPtrToSlot,D0
  484.                   _SlotManager
  485.                   ENDM
  486.  
  487.                   MACRO
  488.                   _SFindSInfoRecPtr
  489.                   MOVEQ       #sFindSInfoRecPtr,D0
  490.                   _SlotManager
  491.                   ENDM
  492.  
  493.                   MACRO
  494.                   _SFindSRsrcPtr
  495.                   MOVEQ       #sFindSRsrcPtr,D0
  496.                   _SlotManager
  497.                   ENDM
  498.  
  499.                   MACRO
  500.                   _SDeleteSRTRec
  501.                   MOVEQ       #sDeleteSRTRec,D0
  502.                   _SlotManager
  503.                   ENDM
  504.  
  505.                   MACRO
  506.                   _SecondaryInit
  507.                   MOVEQ       #sSecondaryInit,D0
  508.                   _SlotManager
  509.                   ENDM
  510.  
  511.                   MACRO
  512.                   _InitSlotPRAM
  513.                   MOVEQ       #sInitSlotPRAM,D0
  514.                   _SlotManager
  515.                   ENDM
  516.  
  517.     ENDIF    ; ...already included